I. Arithmatic operators in the query

Q: How to user + operator in the query?
Ans:
select sysdate + 1 as todaysDate from dual;
select ((2 * 12) + 5/ 5) as result from dual;

Q: Find the average salary from emp table?
Ans:
select sum(sal)/14 as average from emp;

   AVERAGE
----------
2073.21429
*******************************************************************

II. Comparision Operators in the query

Q: Display the employee details whose job is SALESMAN?
Ans:
select * from emp where job = 'SALESMAN';

Q: Display the employee details who are other than SALESMAN?
Ans:
select * from emp where job <> 'SALESMAN';
select * from emp where job != 'SALESMAN';

Q: Display the empolyee details whose salary is more than 3000?
Ans:
select * from emp where sal > 3000;

Q: Display the empolyee details whose salary is more/equal 3000?
Ans:
select * from emp where sal >= 3000;
*******************************************************************

III. Logical Operators in the query

Q: Display the employee details who working as salesman in the deptno 30?
Ans:
select * from emp where job = 'SALESMAN' and deptno = 30;

Q: Display the employee details who is working as President and may have belongs to deptno 30?
Ans:
select * from emp where job = 'PRESIDENT' OR deptno = 30;

Q: Display employee details who is president from deptno 10 and may be getting salary 10 K?
Ans:
select * from emp where (job = 'PRESIDENT' and deptno = 10) OR sal >=10000;


Q: Display employee details who is other than salesman and other than deptno 30;
Ans:
select * from emp where not job = 'SALESMAN' and not deptno=30;
select * from emp where job != 'SALESMAN' and deptno != 30;
select * from emp where job <> 'SALESMAN' and deptno <> 30;


BETWEEN: 
1. It is used to compare with the range of data.
2. The range must be smaller to higher values
3. the datatype used in the lower and higher range must be same.
Ex: BETWEEN 1 and 10 (Correct)
BETWEEN 1 and 'ADAM' (Wrong)
4. It uses OR logical operator between the range of values.
5. In between operator only AND logical operator is allowed.

Q: Display the employee details whose deptno range form 1 to 20?
Ans:
select * from emp where deptno between 1 and 20;

Q: Display the employee details whose ename range 'ALLEN' and 'FORD'?
Ans:
select * from emp where deptno between 'ALLEN' and 'FORD';

Q: Display the employee details whose deptno not range form 1 to 20?
Ans:
select * from emp where deptno not between 1 and 20;


IN:
1. It is also used to compare with multiple datas
2. It applies OR logical operator between the multiple data mentioned

Q: Display the employee details whose empno are 7369, 7499, 7521, 7566, 7654, 1111, 2222?
Ans:
select * from emp where empno in (7369, 7499, 7521, 7566, 7654, 1111, 2222);


Q: Display the employee details whose ename are 'WARD', 'ALLEN', 'SG', 'TESTING'?
Ans:
select * from emp where ename in ('WARD', 'ALLEN', 'SG', 'TESTING');


Q: Display the employee details whose ename are other than 'WARD', 'ALLEN', 'SG', 'TESTING'?
Ans:
select * from emp where ename NOT in ('WARD', 'ALLEN', 'SG', 'TESTING');


Q: Display the employee details whose name stars with 'S'?
Ans:
select * from emp where ename like 'S%';

Q: Display the employee details whose name stars ends 'S'?
Ans:
select * from emp where ename like '%S';

Q: Display the employee details whose name contains 'O'?
Ans:
select * from emp where ename like '%O%';

Q: Display the employee details whose was recruited in the month of DEC?
Ans:
select * from emp where hiredate like '%DEC%';
select * from emp where hiredate like '___DEC___';

Q: Display the employee details whose was not recruited in the month of DEC?
Ans:
select * from emp where hiredate not like '%DEC%';
select * from emp where hiredate not like '___DEC___';
